package com.itany.corejava.code11_io.字符流;

import java.io.*;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年11月28日 13:32
 */
public class Test03_转换流 {
    public static void main(String[] args) {
        try (

                FileInputStream in = new FileInputStream("aaa.txt");
                InputStreamReader reader=new InputStreamReader(in,"UTF-8");//将字节流转换成字符流，同时可以指定编码
                BufferedReader br=new BufferedReader(reader);
                PrintWriter pw=new PrintWriter("aaaa.txt");

        ) {
            String line=null;
            while((line=br.readLine())!=null){
                System.out.println(line);
                pw.println(line);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
